package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface OrderDetailMapper {

    /**
     * @description: 批量插入订单明细数据
     * @author: zhouzhijie
     * @date: 2023/11/22 21:22
     * @param: [orderDetailList]
     * @return:
     **/
    void insertBatch(List<OrderDetail> orderDetailList);

    /**
     * @description: 根据订单id查询订单明细
     * @author: zhouzhijie
     * @date: 2023/11/25 9:53
     * @param: [orderId]
     * @return:
     **/
    @Select("select * from order_detail where order_id = #{orderId}")
    List<OrderDetail> getByOrderId(Long orderId);

    /**
     * @description: 根据订单ids批量查询订单明细
     * @author: zhouzhijie
     * @date: 2023/11/25 9:53
     * @param: [orderId]
     * @return:
     **/
    List<OrderDetail> getByOrderIds(List<Long> ids);

    /**
     * @description: 根据订单idList批量查询每笔订单所对应的订单项
     * @author: zhouzhijie
     * @date: 2023/11/25 11:51
     * @param: [ordersIdList]
     * @return:
     **/
    List<OrderDetail> selectOrderDetailByOrdersIdList(@Param("ordersIdList") List<Long> ordersIdList);


}
